<template>
    <div style="text-align: center">
        <h2 style="text-align: center;position: absolute;width: 100%">正在加载</h2>
        <img src="../../assets/images/loginLoading.gif" style="margin-top: -81px;">
    </div>
</template>
<script type="text/ecmascript-6">
import Cookies from 'js-cookie';
import API from '../../API';
export default{
  data () {
    return {

    };
  },
  methods: {
    getToken () {
      let phplogin = Cookies.get('phplogin');

      if (phplogin) {
        API.checklogin({
          phplogin: phplogin
        }).then((res) => {
          let json = res.data;

          if (json.status === '200') {
            window.localStorage.setItem('TokenID', json.data.TokenID);
            window.localStorage.setItem('loginType', 'normal');
            // Cookies.set('TokenID',json.data.TokenID,{ expires: 7 });
            if (window.closeLogin) {
              window.closeLogin(json.data);
            } else {
              window.top.closeLogin(json.data);
            }
          }
        }).catch(() => {

        });
      }
    }
  },
  mounted () {
    if (localStorage.closeLogin) {
      /* eslint-disable */
      window.closeLogin = eval('(' + localStorage.closeLogin + ')');
      localStorage.removeItem('closeLogin');
    }

    this.getToken();
  }
};
</script>
<style lang="less" >
    @import "../../styles/common";
    body{
        padding: 0;
        margin: 0;
        background: #fff;
    }
</style>
